from typing import List


class Solution:
    # 交换a,b的值


    def sortColors(self, nums: List[int]) -> None:
        """
        Do not return anything, modify nums in-place instead.
        """
        current ,begin,last = 0,0,len(nums)-1
        while current!=len(nums):
            if nums[begin] > nums[last]:
                nums[last],nums[begin] = nums[begin],nums[last]
                print(nums)
                begin += 1
                last -= 1
            if nums[begin] == 0 and nums[current] == 1:
                nums[current], nums[begin] = nums[begin], nums[current]
                begin +=1
                current +=1
if __name__ == '__main__':
    nums = [2,0,2,1,1,0]
    solution = Solution()
    solution.sortColors(nums)

    print(nums)